<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div class="text" >
    你看我几分像从前
  </div>
  <div class="momo" >
    momo
  </div>
  <div id="rotated" style="" >rotated</div>
</body>
<style>
  #rotated {
    background-color: pink;
    width: 200px;
    height: 200px;
    position: absolute;
    top: 50%;
    left: 50%;
  }
</style>
<script>
  // 获取你要旋转的元素
const element = document.getElementById('rotated');

// 添加鼠标移动事件监听器
document.addEventListener('mousemove', function(event) {
  // 计算鼠标位置相对于窗口中心的偏移量
  const x = event.clientX - window.innerWidth / 2;
  const y = event.clientY - window.innerHeight / 2;
  // const z = x +
  console.log("%c Line:37 🍇 y", "color:#93c0a4", y, x);

  // 根据偏移量计算旋转的角度和轴
  // const rotationX = y / window.innerHeight;
  // const rotationY = x / window.innerWidth * 360;
  const rotationY = 0;
  const rotationZ = 0;

  // 设置元素的变换样式
  element.style.transform = `rotate3d(${rotationX}, ${rotationY}, ${rotationZ}, 35deg)`;
});

</script>
</html>
